#ifndef __DEV_SYSTICK_H__
#define __DEV_SYSTICK_H__

#define LOOP_FOREVER 0xFFFF

typedef struct Timer
{
    uint32_t timeout;
    uint16_t time;
    uint16_t repeat;
    void (*timeout_cb)(void);
    void (*repeatend_cb)(void);
    struct Timer *next;
} Timer;

void sys_timer_init(struct Timer *handle, uint16_t time, void (*timeout_cb)(void), uint16_t repeat, void (*repeatend_cb)(void));
int sys_timer_start(struct Timer *handle);
void sys_timer_stop(struct Timer *handle);
void sys_timer_ticks(void);
void sys_timer_loop(void);

// void timer_again(struct Timer* handle);
// void timer_set_repeat(struct Timer* handle, uint32_t repeat);
void systick_init(void);
void swm_delay(__IO uint32_t delay);

#endif //__DEV_SYSTICK_H__
